﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.SlotJoint.SystemIconToImageSourceConverter
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Drawing;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Imaging;


namespace DnProcessSimulateCommands.SlotJoint;

public class SystemIconToImageSourceConverter : IValueConverter
{
  public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  {
    if (value == null)
      return (object) null;
    Icon icon = (Icon) null;
    BitmapSource bitmapSource = (BitmapSource) null;
    switch ((MessageTypes) value)
    {
      case MessageTypes.Warning:
        icon = SystemIcons.Warning;
        break;
      case MessageTypes.Error:
        icon = SystemIcons.Error;
        break;
    }
    if (icon != null)
      bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(16 /*0x10*/, 16 /*0x10*/));
    return (object) bitmapSource;
  }

  public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  {
    throw new NotImplementedException();
  }
}
